<!DOCTYPE html>
<html>
<head>
<title></title>

<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">

<script type="text/javascript" charset="UTF-8" src="jslib/My97DatePicker4.8Beta2/My97DatePicker/WdatePicker.js"></script>

<script type="text/javascript" charset="UTF-8" src="jslib/jquery-easyui-1.2.5/jquery-1.7.1.min.js"></script>

<script type="text/javascript" charset="UTF-8" src="jslib/jquery.cookie.js"></script>

<link id="easyuiTheme" rel="stylesheet" type="text/css" href="jslib/jquery-easyui-1.2.5/themes/gray/easyui.css">
<script type="text/javascript" charset="UTF-8" src="jslib/changeEasyuiTheme.js"></script>
<link rel="stylesheet" type="text/css" href="jslib/jquery-easyui-1.2.5/themes/icon.css">
<script type="text/javascript" charset="UTF-8" src="jslib/jquery-easyui-1.2.5/jquery.easyui.min.js"></script>
<script type="text/javascript" charset="UTF-8" src="jslib/jquery-easyui-1.2.5/locale/easyui-lang-zh_CN.js"></script>

<link rel="stylesheet" type="text/css" href="jslib/jquery-easyui-portal/portal.css">
<script type="text/javascript" charset="UTF-8" src="jslib/jquery-easyui-portal/jquery.portal.js"></script>

<link rel="stylesheet" type="text/css" href="jslib/JQuery-zTree-v3.1/css/zTreeStyle/zTreeStyle.css">
<script type="text/javascript" charset="UTF-8" src="jslib/JQuery-zTree-v3.1/js/jquery.ztree.all-3.1.min.js"></script>

<link rel="stylesheet" type="text/css" href="jslib/erpCss.css">
<script type="text/javascript" charset="UTF-8" src="jslib/erpUtil.js"></script>

<script type="text/javascript" charset="UTF-8">
	$(function() {

		$.ajax({
			url : 'userController.do?getInfo',
			data : {},
			cache : false,
			dataType : "json",
			type : "POST",
			success : function(r) {
				if (r.success) {
					var user = r.obj;
					sy.$modifyPwdForm.find('input[name=id]').val(user.id);
					$('td[name=userId]').html(user.id);
					$('td[name=userName]').html(user.name);
					$('td[name=createdatetime]').html(user.createdatetime);
					$('td[name=modifydatetime]').html(user.modifydatetime);
					$('td[name=roleNames]').html(user.roleNames);
					$('td[name=resourceNames]').html(user.resourceNames);
				} else {
					$.messager.alert('提示', r.msg, 'error');
				}
			}
		});

		sy.$modifyPwdForm = $('#modifyPwdForm').form();

		sy.modifyPwdFun = function() {
			if (sy.$modifyPwdForm.form('validate')) {
				$.ajax({
					url : 'userController.do?modifyPassword',
					data : sy.$modifyPwdForm.serialize(),
					cache : false,
					dataType : "json",
					type : "POST",
					success : function(r) {
						if (r.success) {
							sy.$modifyPwdForm.find('input[name!=id]').val('');
							$.messager.show({
								title : '提示',
								msg : r.msg
							});
						} else {
							$.messager.alert('提示', r.msg, 'error');
						}
					}
				});
			}
		};

		sy.$modifyPwdForm.find('[name=oldPassword],[name=password],[name=rePassword]').bind('keyup', function(event) {/* 增加回车提交功能 */
			if (event.keyCode == '13') {
				sy.modifyPwdFun();
			}
		});

	});
</script>

</head>

<body class="easyui-layout" style="overflow: hidden;">
	<div region="center" border="false" style="overflow: hidden;">
		<fieldset>
			<legend>个人信息查看</legend>
			<table class="tableForm">
				<tr>
					<th>ID</th>
					<td name="userId"></td>
					<th>用户名</th>
					<td name="userName"></td>
					<th style="width: 80px;">创建时间</th>
					<td name="createdatetime"></td>
					<th style="width: 80px;">最后修改时间</th>
					<td name="modifydatetime"></td>
				</tr>
			</table>
			<table class="tableForm">
				<tr>
					<th style="width: 80px;">角色</th>
					<td style="text-align: left;" name="roleNames"></td>
				</tr>
				<tr>
					<th>可访问资源</th>
					<td style="text-align: left;" name="resourceNames"></td>
				</tr>
			</table>
		</fieldset>
		<fieldset>
			<legend>修改密码</legend>
			<form id="modifyPwdForm">
				<input type="hidden" value="" name="id" />
				<table class="tableForm">
					<tr>
						<th>原密码</th>
						<td><input name="oldPassword" type="password" class="easyui-validatebox" required="true" style="width: 155px;" /></td>
						<th>新密码</th>
						<td><input name="password" type="password" class="easyui-validatebox" required="true" style="width: 155px;" /></td>
						<th>重复</th>
						<td><input name="rePassword" type="password" class="easyui-validatebox" required="true" validType="eqPassword['#modifyPwdForm [name=password]']" style="width: 155px;" /></td>
						<th>操作</th>
						<td><a href="javascript:void(0);" class="easyui-linkbutton" onclick="sy.modifyPwdFun();">修改</a></td>
					</tr>
				</table>
			</form>
		</fieldset>
	</div>
</body>
</html>
